import time
from playwright.sync_api import sync_playwright


def test_a3mall_pw():
    # 初始化框架并启动后台
    with sync_playwright() as p:
        browser=p.chromium.launch(headless=False)
        # 打开新的页面
        page=browser.new_page()
        # 访问目标网址
        page.goto('http://10.59.9.14:7003/')
        time.sleep(3)

        # 点击登录
        page.click('xpath = /html/body/div[1]/div/div[2]/ul/li[1]/a')
        # 会员登录断言
        dy1=page.locator('xpath = /html/body/div[4]/div/div[1]/div[1]/span[1]').text_content()
        print(dy1)
        time.sleep(3)
        # 输入账号密码
        page.click('xpath = //*[@id="theForm"]/div[1]/span[2]/input , 13811033962')
        page.click('xpath = //*[@id="theForm"]/div[2]/span[2]/input , 123456')
        time.sleep(3)
        # 点击登录按钮
        page.click('xpath = //*[@id="theForm"]/div[5]/a')
        time.sleep(3)
        # 点击首页

    # print("结束")